package top.jle.wx.proxy.api.templateMsg;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import top.jle.wx.proxy.api.ResponseBack;
import top.jle.wx.proxy.facade.TemplateMsgFacade;

import static top.jle.wx.proxy.constant.TemplateMsgOption.IndustryResponse;

@RestController
@RequestMapping("/template/industry")
@Tag(name = "模板消息API")
public class IndustryAPI {

    @Autowired
    private TemplateMsgFacade templateMsgFacade;

    @Operation(summary = "设置模板消息行业信息",description = "每月可修改行业1次")
    @PostMapping("/set")
    public ResponseBack<Boolean> set(@Parameter(description = "主营行业编号 <a href='doc/industryList.html'>行业信息</a>") @RequestParam Integer primaryIndustryNumber,
                                     @Parameter(description="副营行业编号") @RequestParam Integer secondIndustryNumber){
        templateMsgFacade.setInventory(primaryIndustryNumber,secondIndustryNumber);
        return ResponseBack.success(true);
    }

    @Operation(summary = "获取模板消息设置的行业信息")
    @GetMapping("/get")
    public ResponseBack<IndustryResponse> get(){
       IndustryResponse response =  templateMsgFacade.getIndustry();
       return ResponseBack.success(response);
    }

}
